<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>阿里巴巴面试题</title>
    </head>
    <body>
        <script>
            //class 替代 es5中的构造函数
            // class A {
            //     constructor() {}
            // }
            class Money {
                static add(one, two) {
                    return one.number + two.number; // 打印171
                }
                constructor(number) {
                    console.log(this); //打印
                    this.number = number;
                }
                valueof() {
                    return this.number;
                }
            }

            let one = new Money(101);
            let two = new Money(70);
            let three = Money.add(one, two);
            console.log(three);
            let four = one.add(two);
            // let five = new Money(one + two);

            // console.log(`${three}===>${four}===>${five}`);   //171
        </script>
    </body>
</html>
